#pragma once
#ifndef __LINKTREE_H__
#define __LINKTREE_H__
#define ElementType struct UniversalType
enum Type
{
	charType,
	structType
};
struct UniversalType
{
	void* value;
	enum Type type;
};
typedef struct LinkTreeNode
{
	ElementType data;
	struct UniversalType* firstchild;
	struct UniversalType* brother;
	struct UniversalType* parent;
}LTNode;

typedef struct LinkTree
{
	struct LinkTreeNode* root;
}LTree;

LTNode* CreateTreeNode(ElementType element);
void ConnectBranch(LTNode* parent, LTNode* child);
void DisConnectBranch(LTNode* parent, LTNode* child);
void FreeTreeNode(LTNode* treeNode);
void FreeTree(LTree* tree);
void TravelTreeNode(LTNode* node, int deepth, void (*func)(ElementType));
void TravelTree(LTree* tree, void (*func)(ElementType));
int GetTreeHeigth(LTree* tree);
int InitTree(LTree* tree);
LTNode* FindTreeNode(LTree* tree, ElementType element, int (*func)(ElementType, ElementType));
LTNode* FindNode(LTNode* node, ElementType element, int (*func)(ElementType, ElementType));
int GetNodeHeight(LTNode* treeNode);
#endif 
